﻿@model abc.Models.EducationSubType
@{
    ViewBag.Title = "EducationType";
    Layout = "~/Views/Shared/_LayoutPageAdmin.cshtml";
}


<div class="col-md-12">
    <!-- TABLE: LATEST ORDERS -->
    <div class="box box-info">
        <div class="box-header with-border">
            <h3 class="box-title">Education Stream</h3>
            <div class="box-tools pull-right">
                <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
                <button class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
            </div>
        </div><!-- /.box-header -->
        <div class="box-body">
            <div class="table-responsive">
                <table class="table no-margin">
                    <thead>
                    <tr>
                            <th>Education Category</th>
                            <th>Education Type</th>
                            <th>Stream</th>
                            <th>Status</th>
                            <th>Edit</th>
                            <th>Change Status</th>

                        </tr>
                    </thead>
                    <tbody>
@if (ViewBag.GetEducationSubTypeData == null)
{
                        <tr>
                            <td>Please Enter Some Education SubType Type</td>
                        </tr>
}
else
{
    foreach (var item in ViewBag.GetEducationSubTypeData)
    {


                        <tr>
                            <td>@item.EducationCategory.Education_CategoryName</td>
                            <td>@item.EducationType.EducationType_Name</td>
                            <td>@item.EducationSubType_Name</td>
                            <td>@item.EducationSubType_Status</td>
                            <td>
                                @{

        using (
            @Html.BeginForm("EditEducationSubType", "Admin", FormMethod.Post))
        {
           
           <input type="hidden" name="EducationSubType_Id" id="EducationSubType_Id" value="@item.EducationSubType_Id" />
                                    <input type="submit" class="btn btn-default btn-sm" value="Edit " />

        }
                                }
                            </td>

                            <td>
                                @{
        using (@Html.BeginForm("ChangeEducationSubTypeStatus", "Admin", FormMethod.Post, new { @class = "form-horizontal" }))
        {

            <input type="hidden" name="EducationSubType_Id" id="EducationSubType_Id" value="@item.EducationSubType_Id" />
                                    <input type="submit" class="btn btn-default btn-sm" value="Toggle " />

        }
                                }
                            </td>



                        </tr>
    }
}
                    </tbody>
                </table>
            </div><!-- /.table-responsive -->
        </div><!-- /.box-body -->
        <div class="box-footer clearfix">
            <a href="#" class="btn btn-sm btn-info btn-flat btn-success pull-left" data-toggle="modal" data-target="#EducationSubType-modal">Add Qualification</a>
            <a href="#" class="btn btn-sm  btn-flat pull-right">Cancel</a>
        </div><!-- /.box-footer -->
    </div><!-- /.box -->
</div>



<!---Modal--->
<div class="EducationSubType-information">
    <div class="modal modal-success modal fade" tabindex="-1" id="EducationSubType-modal">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="JobOpening-information">Education Stream Information </h4>
                </div>
@{
    using (@Html.BeginForm("SaveEducationSubType","Admin", FormMethod.Post, new { @class = "form-horizontal" }))
    {
                <div class="modal-body">
                  
                        <fieldset>
                            <legend>Education Stream</legend>

                        </fieldset>
                        <br />

                        <div class="form-group">
                            <label for="Stream" class="col-sm-3 control-label">Education Type</label>
                            <div class="col-sm-9">
                              
                                @Html.DropDownListFor(d => d.EducationSubType_EducationCategoryId, (List<SelectListItem>)ViewBag.GetEducationCategoryDropDownData, new { @class = "form-control", @id = "GetEducationCategoryDropDownData" })
                                <br />
                               
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="Stream" class="col-sm-3 control-label">Education Type</label>
                            <div class="col-sm-9">
                           
                                @Html.DropDownListFor(d => d.EducationSubType_EducationTypeId, new SelectList(Enumerable.Empty<SelectListItem>(), "EducationSubType_EducationTypeId", "EducationType.EducationType_Name"), "--Please Select--", new { @class = "form-control", @id = "GetEducationTypeDropDownData" })
                                <br />

                            </div>
                        </div>

                        <div class="form-group">
                            <label for="EducationType_Name" class="col-sm-3 control-label">Basic Education</label>
                            <div class="col-sm-9">
                             @Html.TextBoxFor(d => d.EducationSubType_Name, new { @class="form-control"})
                            </div>
                        </div>


                   
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-outline btn-success pull-left " aria-hidden="true" data-dismiss="modal">Close</button>
                    <input type="hidden" name="EducationSubType_Id" id="EducationSubType_Id" value="@Model.EducationSubType_Id" />
                     <button type="submit" class="btn btn-outline">Save changes</button>
                </div>
}
            }
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div><!-- /.modal -->
</div>

@section scripts
    {<script>
    $(document).ready(function () {
        var Id = $("#EducationSubType_Id").val();
        if ($("#GetEducationCategoryDropDownData").val() != 0) {
            var EcID = $("#GetEducationCategoryDropDownData").val();
            $.getJSON("/Admin/LoadEducationTypeByEducationCategory", { EducationCategoryId: EcID },
                   function (data) {
                       var select = $("#GetEducationTypeDropDownData");

                       $.each(data, function (index, EducationTypeData) {
                           select.append($('<option/>', {
                               value: EducationTypeData.Value,
                               text: EducationTypeData.Text

                           }));
                       });
                   });
            $("#GetEducationTypeDropDownData").val($("EducationSubType_Id").val());
        }
        $("#GetEducationCategoryDropDownData").on('change', function () {
            var EcID = $(this).val();

            $.getJSON("/Admin/LoadEducationTypeByEducationCategory", { EducationCategoryId: EcID },
                   function (data) {
                       var select = $("#GetEducationTypeDropDownData");
                       select.empty();
                       select.append($('<option/>', {
                           value: 0,
                           text: "-Please Select-"
                       }));
                       $.each(data, function (index, EducationTypeData) {
                           select.append($('<option/>', {
                               value: EducationTypeData.Value,
                               text: EducationTypeData.Text
                           }));
                       });
                   });
        });

    });
</script>

    }

